include(ExternalProject)

set(EP_SDL_DIR modules/projects/SDL)
set(SDL_INSTALL_PATH ${PROJECT_SOURCE_DIR}/modules)
set(SDL_BINARY_PATH ${CMAKE_BINARY_DIR}/submodules/SDL)

if (CMAKE_HOST_WIN32)
  #  add_definitions(-DWIN32)
  #  add_definitions(-D_WINDOWS)
  add_definitions(-DUSING_GENERATED_CONFIG_H)
  add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
  add_definitions(-D_NO_CRT_STDIO_INLINE)
  add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE)
  add_definitions(-D_CRT_SECURE_NO_WARNINGS)
  add_definitions(-DSDL_BUILD_MAJOR_VERSION=3)
  add_definitions(-DSDL_BUILD_MINOR_VERSION=1)
  add_definitions(-DSDL_BUILD_MICRO_VERSION=2)
  #  add_definitions(-DCMAKE_INTDIR="${CMAKE_BUILD_TYPE}")
  #  add_definitions(-DDLL_EXPORT)
  set(WINDOWS_STORE OFF)
  set(SDL_LIBC ON)
  set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif ()
set(SDL_STATIC ON)
set(SDL_SHARED OFF)
add_subdirectory(${MODULES_DIR}/projects/SDL)
include_directories(${MODULES_DIR}/projects/SDL/include)